import React, { useState } from 'react';
import { axconst } from '@/shared/axconst';
import Search from './components/search';
import Back from './components/back';
import AxColumnAction from '@/components/AxList/AxColumnAction';
import { AxStandardWideList } from '@/components/AxList/AxStandardWideList';

const Index: React.FC<any> = props => {
  const [backVisible, setBackVisible] = useState(false);
  /** 配置列 */
  const columns = [
    {
      title: '物资名称',
      dataIndex: 'material',
      width: axconst.width.material,
    },
    {
      title: '物资编码',
      dataIndex: 'materialCode',
      width: axconst.width.materialCode,
    },
    {
      title: '领用人',
      dataIndex: 'receiver',
      width: axconst.width.threeonly,
    },
    {
      title: '领用时间',
      dataIndex: 'receiveTime',
      width: axconst.width.time,
    },
    {
      title: '出库单号',
      dataIndex: 'outNumber',
      width: axconst.width.long,
    },
    {
      title: '返库状态',
      dataIndex: 'backStatus',
      width: axconst.width.fouronly,
    },
    {
      title: '操作',
      dataIndex: 'orgName8',
      width: axconst.width.operate8,
      render: (text: any, record: any) => {
        return (
          <AxColumnAction
            buttons={[
              {
                text: '物资返库',
                onClick: () => setBackVisible(true),
              },
            ]}
          />
        );
      },
    },
  ];

  const backProps = {
    visible: backVisible,
    handleVisible: setBackVisible,
  };

  return (
    <>
      <AxStandardWideList
        columns={columns}
        data={{ ...axconst.data }}
        // checkboxModel={false}
        AdvancedSearch={Search}
      />
      {backVisible && <Back  {...backProps} />}
    </>
  );
};

export default Index;
